package io.lvdaxian.mybatis19.executor.statement;

import io.lvdaxian.mybatis19.mapping.BoundSql;
import io.lvdaxian.mybatis19.session.ResultHandler;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

/**
 * statement 语句执行标准
 *
 * @author lihh
 */
public interface StatementHandler {
  
  /**
   * 准备语句
   */
  Statement prepare(Connection connection) throws SQLException;
  
  /**
   * 参数化
   */
  void parameterize(Statement statement) throws SQLException;
  
  /**
   * 执行查询
   */
  <E> List<E> query(Statement statement, ResultHandler resultHandler) throws SQLException;
  
  /**
   * 执行更新
   */
  int update(Statement statement) throws SQLException;
  
  /**
   * 获取绑定SQL
   */
  BoundSql getBoundSql();
}
